package com.ai.modbus;

import com.serotonin.modbus4j.ModbusFactory;

/**
 * 静态内部类单例话modbus工厂
 * @Author jiaok
 * @Date 2024-11-25 15:59
 */
public class ModbusFactoryProvide {

    private ModbusFactoryProvide(){

    }

    public static ModbusFactory getModbusFactory() {
        return ModbusFactoryHolder.INSTANCE;
    }

    /**
     * 使用静态内部类延迟加载
     */
    private static class ModbusFactoryHolder{
        private static final ModbusFactory INSTANCE = new ModbusFactory();
    }


}
